package com.da.javatest.bean;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import lombok.Data;
import red.zyc.desensitization.Sensitive;
import red.zyc.desensitization.annotation.CascadeSensitive;
import red.zyc.desensitization.annotation.CharSequenceSensitive;
import red.zyc.desensitization.annotation.ChineseNameSensitive;
import red.zyc.desensitization.annotation.EmailSensitive;
import red.zyc.desensitization.annotation.IdCardNumberSensitive;
import red.zyc.desensitization.annotation.PasswordSensitive;
import red.zyc.desensitization.annotation.UsccSensitive;

@Data
public class Child {

    @ChineseNameSensitive
    private String name = "李富贵";

    @IdCardNumberSensitive
    private String idCardNumber = "321181199301096000";

    @UsccSensitive
    private String unifiedSocialCreditCode = "91310106575855456U";

    @CharSequenceSensitive
    private String string = "123456";

    @EmailSensitive
    private String email = "123456@qq.com";

    @PasswordSensitive
    private String password = "123456";

    //@CascadeSensitive
    //private Mother mother = new Mother();
    //
    //@CascadeSensitive
    //private Father father = new Father();

    private @PasswordSensitive String[] passwords = {"123456", "1234567", "12345678"};

    //private List<@CascadeSensitive Parent> parents1 = Stream.of(new Father(), new Mother()).collect(Collectors
    // .toList());

    private List<@EmailSensitive String> emails1 = Stream.of("123456@qq.com", "1234567@qq.com", "1234568@qq.com")
        .collect(Collectors.toList());

    private Map<@ChineseNameSensitive String, @EmailSensitive String> emails2 = Stream.of("张三", "李四", "小明")
        .collect(Collectors.toMap(s -> s, s -> "123456@qq.com"));

    public static void main(String[] args) {
        Child child = Sensitive.desensitize(new Child());
        System.out.println(child);
    }
}